home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nobeep / nobeep.txt < prev   
Encoding:
Text File  |  1994-11-30  |  808 b   |  29 lines

  1. ' Make a text box on a form called text1
  2. ' Paste this code into the Declaration part of the form
  3. ' Set the MultiLine property to False
  4. ' Add text, press ENTER and see what happens
  5. ' Have fun!!!   
  6.  
  7. ' Blaine (73730,761)
  8.  
  9. ' PS If you've got a neat trick, pass it on... I'd like to
  10. ' hear about it.
  11.  
  12. Sub text1_KeyDown (KeyCode As Integer, Shift As Integer)
  13.     Select Case KeyCode
  14.            Case KEY_RETURN
  15.             KeyCode = 0
  16.                 ' add routine for when user hits <ENTER>
  17.                 msgbox "You hit enter and there was NO BEEP!!!"
  18.  
  19. '          Case ...  add for other keys here (i.e. <ESC> to cancel)
  20.  
  21.    End Select
  22. Exit Sub
  23.  
  24.  
  25. Sub text1_KeyPress (KeyAscii As Integer)
  26.     Const RETURN_KEY_PRESSED = 13
  27.     If KeyAscii = RETURN_KEY_PRESSED Then KeyAscii = 0
  28. End Sub
  29.